package com.asiainfo.dacp.datastash.worker.executor.adapter.datax.utils;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import com.asiainfo.dacp.datastash.worker.executor.adapter.datax.model.plugin.FtpReader;
import com.asiainfo.dacp.datastash.worker.executor.adapter.datax.model.plugin.FtpWriter;
import com.asiainfo.dacp.datastash.worker.executor.adapter.datax.model.plugin.MysqlWriter;
import com.asiainfo.dacp.datastash.worker.executor.adapter.datax.model.plugin.RdbmsReader;

@Configuration
public class PluginFactory {
	
	@Bean(name={"mysqlreader","rdbmsreader"})
	public RdbmsReader rdbmsReader(){
		return new RdbmsReader();
	}  
	
	public static void main(String[] args) {
		 AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(PluginFactory.class);  
	     
		 
		 FtpReader bean = (FtpReader)ctx.getBean("a");
		 
		 System.out.println(bean == null);
		 bean.setNullFormat("xxxx");
		 FtpReader bean2 = (FtpReader)ctx.getBean("b");
		 System.out.println(bean2 == null);
		 System.out.println(bean2.getNullFormat());
		 System.out.println(bean == bean2);
	}
	
}
